import request from '@/utils/axios'

/**
 * 社交账号相关接口
 */
export const SocialApi = {
  // 社交绑定，使用 code 授权码
  bind: (type, code, state) => {
    return request.post({
      url: '/system/social-user/bind',
      data: {
        type,
        code,
        state
      },
      is_mock: true
    })
  },
  // 取消社交绑定
  unbind: (type, openid) => {
    return request.delete({
      url: '/system/social-user/unbind',
      data: {
        type,
        openid
      },
      is_mock: true
    })
  },
  // 社交授权的跳转
  redirect: (type, redirectUri) => {
    return request.get({
      url: '/system/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri,
      is_mock: true
    })
  }
}
